package com.qfedu.mapper;

import com.qfedu.model.Contractor;
import com.qfedu.model.Developer;
import com.qfedu.model.Stage;
import com.qfedu.model.Project;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * @author LiJH
 * @date 2023-02-10
 */
public interface StageMapper {
    @Select("select count(*) from stage where status=1")
    long count();
    @Select("select * from stage where status=1 limit #{currentPage},#{pageSize}")
    List<Stage> findPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize);

    @Insert("insert into stage(sid,sname,starttime,endtime,pid,updatetime)" +
            " values(#{sid},#{sname},#{starttime},#{endtime},#{pid},#{updatetime}) ")
    int addStage(Stage stage);

    @Select("select * from stage where sid=#{sid} and status=1 ")
    Stage findById(String sid);

    @Update("update stage set sname=#{sname},starttime=#{starttime},endtime=#{endtime}," +
            "pid=#{pid},updatetime=#{updatetime} where sid=#{sid}")
    int editStage(Stage stage);

    //删除
    @Update("update stage set status=1 where sid = #{sid}")
    int deleteBySid(String sid);

    @Select("select * from stage where pid=#{pid}")
    List<Stage> findByPid(int pid);


}
